<template>
    <view style="padding: 10px 20px;">

        <view style="margin-bottom:20upx" v-for="item in tabBasicList" :key="item.key">
            <view style="margin-bottom: 20px;">
                <view>
                    {{ item.name }}
                </view>
                <view v-if="item.list.length">
                    <mainList :baseList="item.list" type="high"/>
                </view>
                <view v-else>
                    <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/car.png">
                    </u-empty>
                </view>
            </view>

        </view>


    </view>
</template>

<script>
import mainList from '@/components/mainList/index.vue'
import uTabs from '@/components/uTabs/index.vue'
export default {
    components: {
        mainList,
        uTabs
    },
    data() {
        return {
            tabBasicList: [
                {
                    name: '我的企业',
                    key: 'product_qiye',
                    list: []
                },
                {
                    name: '投资机构',
                    key: 'product_tzjg',
                    list: []
                },
                {
                    name: '我的项目',
                    key: 'product_xiangmu',
                    list: []
                }
            ],
        }
    },
    onShow() {
        this.getList()
    },
    methods: {
        async getList() {
            const res = await this.$api.getMyCollect({})
            this.tabBasicList = [
                {
                    name: '我的企业',
                    key: 'product_qiye',
                    list: res.product_qiye.map(item => {
                        return {
                            ...item,
                            name: item.simplename,
                            desc_text: item.smalltext,
                            city: '已收藏',
                            img_url: item.image
                        }
                    })
                },
                {
                    name: '投资机构',
                    key: 'product_tzjg',
                    list: res.product_tzjg.map(item => {
                        return {
                            ...item,
                            name: item.simplename,
                            desc_text: item.smalltext,
                            city: '已收藏',
                            img_url: item.image
                        }
                    })
                },
                {
                    name: '我的项目',
                    key: 'product_xiangmu',
                    list: res.product_xiangmu.map(item => {
                        return {
                            ...item,
                            name: item.simplename,
                            desc_text: item.smalltext,
                            city: '已收藏',
                            img_url: item.image
                        }
                    })
                }
            ]
        },
        handleEnter() {
            uni.navigateTo({
                url: '/pages/company/enter'
            })
        }
    }
}
</script>

<style></style>